const path = require('path'),
    Koa = require('koa'),
    convert = require('koa-convert'),
    koaStatic = require('koa-static'),
    views = require('koa-views')
    bodyParser = require('koa-bodyparser'),
    config = require('./../config'),
    routers = require('./routers/index');
    cors = require('koa2-cors');
    app = new Koa();



app.use(bodyParser());

app.use(convert(koaStatic(
    path.join(__dirname,'./../static')
)));

app.use(views(path.join(__dirname, './views'), {
    // extension: 'ejs'
}));

app.use(cors());

app.use(routers.routes()).use(routers.allowedMethods());

app.listen(config.port,function () {
    console.log('server is start')
});


